package com.wujie.market.controller;

import com.wujie.market.po.Orderdetail;
import com.wujie.market.po.ShopCat;
import com.wujie.market.service.OrderdetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * ClassName: OrderDetailController
 * Description:
 * date: 2023/2/22 12:27
 *
 * @author 吴杰
 * @since JDK 1.8.0_31
 */
@RestController
@RequestMapping("/orderDetail")
public class OrderDetailController {
    @Autowired
    private OrderdetailService orderdetailService;

    @RequestMapping("/list")
    public List<Orderdetail> list() {
        return orderdetailService.listAll();
    }


    /**
    * Description:生成订单
    * @author: 吴杰
    * @date: 2023/2/22 15:25
    * @param:
     * * @return:
    */
    @RequestMapping("/insertBatch")

    public void addOrder(@RequestBody List<Orderdetail> orderdetail){

        orderdetailService.addOrder(orderdetail);
    }
    /**
    * Description:插入一条数据
    * @author: 吴杰
    * @date: 2023/2/22 16:46
    * @param:
     * * @return:
    */
    @RequestMapping("/insertOne")
    public void insertOne(@RequestBody Orderdetail orderdetail){
        orderdetailService.insertOne(orderdetail);
    }
}
